package com.iqi.onigao.module.warehouse;

import java.util.List;
import java.util.Map;

import com.iqi.onigao.constant.SessionConstant;
import com.iqi.onigao.context.Bean;
import com.iqi.onigao.module.user.UserBO;

import net.IClient;
import net.Package;
import si.client.CWarehouse;
import si.pod.ItemPOD;
@Bean(WarehouseBO.class)
public class WarehouseBOImpl extends CWarehouse implements WarehouseBO {

	@Override
	public boolean notifyItemChange(IClient session, Package p, List<ItemPOD> datas) {
		Map<Long, ItemPOD> items = session.getAttr(SessionConstant.ITEMS);
		
		for (ItemPOD itemPOD : datas) {
			if (itemPOD.getNum() <= 0) {
				items.remove(itemPOD.getId());
			}else {
				items.put(itemPOD.getId(),itemPOD);
			}
		}
		return true;
	}

}
